<?php
namespace app\admin\controller;

class Index extends Common
{
    public function index()
    {	
    	
        return $this->fetch();
    }

    //个人中心
    public function personal_center()
    {
    	if(request()->isAjax()){
    		$passwd = input('passwd');

    		if(!empty($passwd)){
                $passwd = Model('Admin')->add_hash($passwd);
    			$data['password'] = $passwd;
    		}

    		$result = Model('Admin')->update_value(['id'=>$this->info['id']],$data);
    		if(!$result)return $this->error('修改失败!');
    		$this->success('修改成功');
    	}

    	$info = Model('Admin')->index(['id'=>$this->info['id']]);
        $info['logintime'] = date('Y-m-d',$info['logintime']);
    	$this->assign('member',$info);
    	return $this->fetch();
    }
}
